#include "list.hpp"
#include <iostream>
using namespace std;

struct pos
{
	int x;

	bool operator==(const pos& one)
	{
		return x == one.x;
	}

	bool operator!=(const pos& one)
	{
		return x != one.x;
	}
};

void test1()
{
	my::list<pos> one = { { 1 }, { 2 }, { 3 }, { 4 }, { 5 } };

	for (auto e : one)
	{
		cout << e.x << " ";
	}
	cout << endl;

	my::list<pos>::iterator it = one.begin();
	//it->
	it->x = 6;
	cout << (*it).x << endl;

	++it;
	it->x = 6;

	for (auto e : one)
	{
		cout << e.x << " ";
	}
	cout << endl;

	cout << (one.begin() == it) << endl;
	
	++it;
	cout << (one.begin() == it) << endl;
}

void test2()
{
	my::list<int> list1 = { 1, 2, 3, 4, 5 };

	//my::list<int>::reserve_iterator it = list1.end();
	
	//my::list<int>::iterator it2 = list1.end();
	my::list<int>::reverse_iterator it = list1.rbegin();

	while (it != list1.rend())
	{
		cout << (*it) << " ";
		++it;
	}
	cout << endl;

	//while (it2 != list1.end())
	//{
	//	cout << (*it2) << " ";
	//	++it2;
	//}
}

void test3()
{
	my::list<int> list1 = { 1, 2, 3, 4, 5 };

	my::list<int>::iterator it1 = list1.begin();
	while (it1 != list1.end())
	{
		cout << *it1 << " ";
		++it1;
	}
	cout << endl;

	my::list<int>::reverse_iterator it3 = list1.rbegin();
	while (it3 != list1.rend())
	{
		cout << *it3 << " ";
		++it3;
	}
	cout << endl;

	const my::list<int> list2 = { 6, 7, 8, 9, 10 };

	my::list<int>::const_iterator it2 = list2.begin();
	while (it2 != list2.end())
	{
		cout << *it2 << " ";
		++it2;
	}
	cout << endl;

	my::list<int>::const_reverse_iterator it4 = list2.rbegin();
	while (it4 != list2.rend())
	{
		cout << *it4 << " ";
		++it4;
	}
	cout << endl;
}

int main()
{
	//test1();
	//test2();
	test3();

	return 0;
}



